package cn.lzd.util

import java.util
import scala.collection.JavaConverters._

/**
  * Created by lzd on 2019/3/26.
  */
object IdsUtils {

  def idsHandler(javaList: java.util.List[String]): util.Map[String, util.Set[String]] = {
    val toList: List[String] = javaList.asScala.toList
    val map: Map[String, List[String]] = toList.groupBy(_.split("=", -1)(0))

    val values: util.Map[String, util.Set[String]] = map.mapValues((x) => {
      x.flatMap(_.split("=", -1)(1).split(",")).toSet.asJava
    }).asJava

    values
  }
}
